/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
    user-select: none;
}

/* Responsive container - adapts to iframe vs full window */
#gameContainer {
    width: 100%;
    height: 450px; /* Default iframe height */
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Full window mode detection */
@media (min-height: 500px) {
    #gameContainer {
        height: 90vh;
    }
}

/* Location selector panel */
#locationSelector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    height: 100%;
    padding: 20px;
    flex-wrap: wrap;
}

.location-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    min-width: 120px;
    max-width: 150px;
    flex: 1;
}

.location-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    background: #f8f9ff;
}

.location-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.location-name {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 5px;
    color: #333;
}

.difficulty {
    font-size: 0.9em;
    color: #666;
    padding: 3px 8px;
    border-radius: 10px;
    background: #e8f4f8;
}

/* Game area styles */
#gameArea {
    height: 100%;
    display: flex;
    flex-direction: column;
}

#gameHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid #e0e0e0;
    min-height: 50px;
}

#currentLocation {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
}

#statsPanel {
    display: flex;
    gap: 15px;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
}

.stat-icon {
    font-size: 1.2em;
}

#backBtn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

#backBtn:hover {
    background: #ff5252;
    transform: scale(1.05);
}

/* Game viewport */
#gameViewport {
    flex: 1;
    position: relative;
    background: linear-gradient(to bottom, #87CEEB 0%, #98FB98 100%);
    overflow: hidden;
    border: 2px solid #ddd;
}

/* Character */
#character {
    position: absolute;
    font-size: 2em;
    transition: all 0.3s ease;
    z-index: 10;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* Signs container */
#signsContainer {
    position: absolute;
    width: 100%;
    height: 100%;
}

.traffic-sign {
    position: absolute;
    font-size: 2em;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 5;
    padding: 5px;
    border-radius: 50%;
    background: rgba(255,255,255,0.8);
}

.traffic-sign:hover {
    transform: scale(1.2);
    background: rgba(255,255,255,1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* Action prompt */
#actionPrompt {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    z-index: 20;
    max-width: 80%;
}

.prompt-text {
    font-size: 1.1em;
    margin-bottom: 15px;
}

.prompt-actions button {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    margin: 5px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.prompt-actions button:hover {
    background: #45a049;
    transform: scale(1.05);
}

/* Mini-map */
#miniMap {
    position: absolute;
    top: 60px;
    right: 10px;
    width: 120px;
    height: 80px;
    background: rgba(255,255,255,0.9);
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 5px;
}

.minimap-title {
    font-size: 0.8em;
    font-weight: bold;
    text-align: center;
    margin-bottom: 5px;
}

#minimapContent {
    position: relative;
    width: 100%;
    height: calc(100% - 20px);
    background: #e8f5e8;
    border-radius: 5px;
}

#playerDot {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #ff4444;
    border-radius: 50%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* Controls panel */
#controlsPanel {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(255,255,255,0.9);
    padding: 10px;
    border-radius: 10px;
    border: 2px solid #ddd;
}

.controls-title {
    font-size: 0.8em;
    font-weight: bold;
    text-align: center;
    margin-bottom: 5px;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    margin-bottom: 5px;
}

.control-btn {
    width: 30px;
    height: 30px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover, .control-btn:active {
    background: #e3f2fd;
    border-color: #2196F3;
    transform: scale(0.95);
}

.keyboard-hint {
    font-size: 0.7em;
    text-align: center;
    color: #666;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 20px;
    max-width: 90%;
    max-height: 80%;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #999;
}

.close-btn:hover {
    color: #333;
}

#signImage {
    text-align: center;
    font-size: 4em;
    margin: 20px 0;
}

#signQuestion {
    font-size: 1.1em;
    margin-bottom: 20px;
    text-align: center;
}

#signOptions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-btn {
    background: #f5f5f5;
    border: 2px solid #ddd;
    padding: 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.option-btn:hover {
    background: #e3f2fd;
    border-color: #2196F3;
}

.option-btn.correct {
    background: #c8e6c9;
    border-color: #4CAF50;
}

.option-btn.incorrect {
    background: #ffcdd2;
    border-color: #f44336;
}

/* Achievement notification */
#achievementNotification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 1001;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.achievement-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.achievement-icon {
    font-size: 1.5em;
}

/* Tooltip */
#tooltip {
    position: absolute;
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 0.9em;
    z-index: 1002;
    pointer-events: none;
    white-space: nowrap;
    max-width: 200px;
    white-space: normal;
}

/* Utility classes */
.hidden {
    display: none !important;
}

.panel {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    margin: 10px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    #locationSelector {
        gap: 10px;
        padding: 10px;
    }
    
    .location-card {
        min-width: 100px;
        padding: 15px;
    }
    
    .location-icon {
        font-size: 2em;
    }
    
    #gameHeader {
        padding: 8px 10px;
        font-size: 0.9em;
    }
    
    #miniMap {
        width: 100px;
        height: 70px;
    }
    
    #controlsPanel {
        bottom: 5px;
        left: 5px;
        padding: 8px;
    }
    
    .control-btn {
        width: 25px;
        height: 25px;
    }
}

/* Touch-friendly sizing for mobile */
@media (pointer: coarse) {
    .control-btn {
        width: 35px;
        height: 35px;
    }
    
    .traffic-sign {
        font-size: 2.5em;
        padding: 10px;
    }
    
    .location-card {
        padding: 25px;
    }
}